<template>
  <el-tabs :value="productPage" type="card">
    <el-tab-pane label="产品信息" name="0">
      <tour-product @saveNext="saveNext" v-if="pageType !== ''"
                    :productIdConfig="productId" :pageType="pageType"></tour-product>
    </el-tab-pane>
    <el-tab-pane label="价格库存" name="1">
      <price-inventory v-if="pageType !== ''" :pageType="pageType" :productIdConfig="productId"></price-inventory>
    </el-tab-pane>
    <el-tab-pane label="审核结果" name="2" v-if="pageType === 'audits'">
      <audits-product :productId="productId"></audits-product>
    </el-tab-pane>
  </el-tabs>
</template>

<script type="text/ecmascript-6">
//  import {getUrlParam3} from '../../../common/js/util.js'
  import tourProduct from './tourProduct.vue'
  import priceInventory from './priceInventory.vue'
  import auditsProduct from './auditsProduct.vue'
  export default {
    data () {
      return {
        pageType: '',
        productPage: '',
        productId: 0
      }
    },
    methods: {
      saveNext (val, val2) {
        this.productPage = val
        this.productId = val2
      }
    },
    mounted () {
//      resetBreads(this)
      var user = sessionStorage.getItem('user')
      if (user) {
        this.pageType = this.$route.params.pageType
//        this.pageType = getUrlParam3('pageType')
//        this.productId = Number(getUrlParam3('id'))
        if (this.pageType === undefined) {
          this.$router.push({path: '/productManageList'})
        } else {
          this.productId = this.$route.params.id
          if (this.pageType === 'audits') {
            this.productPage = '2'
          } else if (this.pageType === 'price') {
            this.productPage = '1'
          } else {
            this.productPage = '0'
          }
        }
      }
    },
    components: {
      tourProduct,
      priceInventory,
      auditsProduct
    }
  }
</script>

<style lang="stylus" rel="stylesheet/stylus">

</style>
